package com.eduService.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 *    封装配置信息
 *    InitializingBean：
 *    Spring容器会在创建该Bean之后，
 *    自动调用该Bean的setApplicationContext（参数）方法，
 *    调用该方法时，会将容器本身ApplicationContext对象作为参数传递给该方法。
 */

@Component
public class ConstantProperties implements InitializingBean {
    //读取配置文件信息
    @Value("${aliyun.oss.file.endpoint}")
    private  String endpoint;

    @Value("${fealiyun.oss.file.keyid}")
    private  String keyid;

    @Value("${aliyun.oss.file.keyword}")
    private  String keyword;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketname;

    //定义公开常量
    public static String END_POINT;
    public static  String KEY_ID;
    public static String KEY_WORD;
    public static String BUCKET_NAME;


    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint;
        KEY_ID = keyid;
        KEY_WORD =keyword;
        BUCKET_NAME= bucketname;
    }
}
